﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using BlackBird.Models;

namespace BlackBird.ControllerHelpers
{
	public class FileUploadHelper
	{
		public static string SaveUploadFile(HttpPostedFileBase hpf, SupportTypes currentType)
		{
			string ParentFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "File");
			string fileName = currentType.ToString() + "_" + Guid.NewGuid().ToString() + "_" + Path.GetFileName(hpf.FileName);
			string savedFilePath = Path.Combine(ParentFolder, fileName);

			hpf.SaveAs(savedFilePath);

			return savedFilePath;
		}
	}
}